// 二次封装axios
const request = axios.create({
  // baseURL: "http://hmajax.itheima.net/api/",
  baseURL: "http://106.53.218.88:10010/",
  timeout: 1000 * 60,
});
// 请求拦截器
request.interceptors.request.use(
  function (config) {
    // 设置token
    if (localStorage.getItem("token")) {
      config.headers.token = localStorage.getItem("token");
    }
    return {
      headers: {
        "Content-Type": "application/json;charset=UTF-8",
      },
      ...config,
    };
  },
  function (error) {
    console.log(error);
    return Promise.reject(error);
  }
);
//响应拦截器
request.interceptors.response.use(
	(response) => {
		return response;
	},
	(error) => {
		return Promise.reject(error);
	}
);


export default request;